home *** CD-ROM | disk | FTP | other *** search
/ PC Format (UK) 188 / 01-04 PC Format 188 [2006-06] DVD side 1_.iso / DiscContents / Workshops / Workshops_Games / Gamer's Internet Tunnel / Git-099b4.exe / {app} / Wizard Scripts.txt < prev   
Text File  |  2004-10-03  |  17KB  |  382 lines

  1. Gamer's Internet Tunnel Wizard Scripts
  2.  
  3. ------
  4. Basics
  5. ------
  6. Files should be named *.git and placed in the location GIT is installed.
  7. Scripts are simple text files containing one command per line.  Each command
  8. can have zero or more parameters, each separated by whitespace.  The '#'
  9. character can be used for a comment that lasts until the end of the line.
  10. Commands and variables take the form [A-Za-z_][A-Za-z0-9_]* and parameters can
  11. typically be a variable name, a string, or an integer.  Strings start end end
  12. with double quotes (") and can contain two double quotes in a row to place one
  13. double quote in the string such as "hello ""world""" which represents the
  14. string hello "world".  Integers can prefixed with a minus sign (-) for negative
  15. numbers, or 0x to signify a hexadecimal number.
  16.  
  17.  
  18. --------
  19. Commands
  20. --------
  21. Each command is listed here along with the types of parameters it accepts.
  22. [var] means the parameter must be a variable name while [str] means the
  23. parameter can be anything that evaluates to a string (variables willl be
  24. evaluated and integers will be cast to strings). [int] means anything that
  25. evaluates to an integer. [sym] means a specific symbol from a list of choices
  26. is the only thing accepted for that parameter.  Unitialized variables will
  27. default to an empty string or the value 0 if referenced.
  28.  
  29. setvar [var] [str/int]
  30.     Sets the variable to be equal to the second parameter.
  31. math [var] [int] [sym] [int]
  32.     Sets the variable equal to a math operation performed on the two
  33.     integers.  Valid operations are + - * / %
  34. addflag [var] [int]
  35.     Sets a bit flag or flags in the variable.  Basically like |= in C.
  36. removeflag [var] [int]
  37.     Removes a bit flag or flags in the variable. Like &=~ in C.
  38. prependstring [var] [str]
  39.     Adds on the string at the beginning of the variable.
  40. appendstring [var] [str]
  41.     Adds on the string to the end of the variable.
  42. findstring [var] [str] [str] [int]
  43.     Searches in the first string for the second string, starting at the
  44.     position specified by the integer and stores the result in the
  45.     variable. Positions are 0-based and the variable is set to -1 if no
  46.     match is found.
  47. reversefindstring [var] [str] [str] [int]
  48.     Like findstring, but searches backwards from the end of the string.
  49. stringlength [var] [str]
  50.     Sets the variable to be the integer value of the length of the string.
  51. substring [var] [str] [int] [int]
  52.     Sets the variable to be a piece of the string starting at the position
  53.     specified by the first integer and with a maximum length specified by
  54.     the second integer, which can be -1 to mean the rest of the string.
  55. numlines [var] [str]
  56.     Sets the variable to be the number of lines in the string.
  57. getline [var] [str] [int]
  58.     Sets the variable to be one line from the string as specified by the
  59.     integer.  The lines are numbered starting with 0.
  60. setline [var] [int] [str]
  61.     Overwrites a line in the variable specified by the integer with the
  62.     contents of the string.  Will append a new line for the string if the
  63.     integer does not specify a valid line number.
  64. addline [var] [str]
  65.     Adds a new line to the end of the variable and appends the string on
  66.     that new line.
  67. deleteline [var] [int]
  68.     Removes a line from the variable as specified by the integer.  Will do
  69.     nothing if the line does not exist.
  70. sortlines [var]
  71.     Sorts all of the lines in the variable.
  72. splitlines [var] [str]
  73.     Splits up a variable into numerous lines delimited by the string.
  74. joinlines [var] [str]
  75.     Joins all of the lines in the variable into one big line, placing a copy
  76.     of the string between each piece.
  77. removeblanklines [var]
  78.     Deletes all of the blank lines from the variable.
  79. if [str/int] [sym] [str/int]
  80.     Compares two strings or two integers to control script flow.
  81.     If either value is a string, both will be treated like strings.
  82.     Valid operations are = < > <= >= con
  83.     Operations can be prefixed with a ! to negate the results.
  84.     The con operator for integers is used to test of the first integer
  85.     contains all of the bit flags of the second integer.
  86.     The < > <= and >= operators for strings compare the strings sort order.
  87.     The con operator for strings is used to determine if the first string
  88.     contains the second string.
  89. elseif [str/int] [sym] [str/int]
  90.     Works like if, but there can be any number of these.  Only the first
  91.     true elseif block is executed, and only if the if block wasn't executed.
  92. else
  93.     The last choice if none of the if's or elseif's were true.
  94.     There can be only one of these per if block.
  95. endif
  96.     Marks the end of the if/elseif/else block.
  97.     All if's must have a corresponding endif.
  98. while [str/int] [sym] [str/int]
  99.     Works like if to test for true or false, but will loop through the
  100.     block until the test is false.
  101. endwhile
  102.     Marks the end of the while block.  Execution jumps back up to the
  103.     corresponding while and the test is repeated.
  104. loadvar [var]
  105.     Loads a variable's value from the registry.  The value is loaded as
  106.     soon as it is requested by executing the loadvar command. Wizard script
  107.     variables can be stored in HKCU\Software\Git\Wizard
  108.     Loadvar will check the savevar temporary holding spot and load from that
  109.     if it exists before actually loading from the registry.  This allows
  110.     loadvar/savevar/showpage to work together nicely.
  111. savevar [var]
  112.     Saves a variable's value into a temporary holding spot.  The variable
  113.     is only actually saved to the registry if the script completes
  114.     successfully by way of the finish command.  The value saved is the
  115.     value the variable had at the time the savevar command was executed.
  116.     When using loadvar/savevar, your settings can be shared with other
  117.     scripts, so if you use the same variable name as another script, please
  118.     make sure it has exactly the same meaning in both scripts.
  119. showpage
  120.     Shows the wizard dialog page.  See the Dialog Controls section for how
  121.     to configure the wizard page controls.
  122.     Pressing the back button on the page will cause the execution point in
  123.     the script to jump back to the line after the previous showpage that was
  124.     executed, or the beginning of the script if only one showpage had been
  125.     executed so far.  Pressing the back button on the first page will cause
  126.     the wizard to start completely over and clear all variables.
  127. finish {[str]}
  128.     Shows the final wizard dialog page, with the finish button. The
  129.     optional string parameter will be displayed as a label on the finish
  130.     page along with a message about which button to press.  If the user
  131.     picks the finish button then the savevar variables will be stored, and
  132.     and special variables will be configured and the GIT tunnel will be
  133.     restarted with the new settings.
  134. cancel {[str]}
  135.     Shows a wizard page with only a cancel button and allows an optional
  136.     message to be displayed on a label.  This forces the user to abandon
  137.     all choices made so far and is used when the choices made cannot
  138.     work for the program the script is trying to configure GIT for.
  139.  
  140.  
  141. -----------------
  142. Special Variables
  143. -----------------
  144. There are several types of special variables in GIT wizard scripts.
  145. Dialog Control variables are described below, in their own section.
  146.  
  147. Configuration variables are used to alter GIT settings and will be pre-set
  148. with the current GIT setting values when the script starts.
  149. Integer configuration variables:
  150.     device - The packet device selected from the 0 based index of choices.
  151.     multiport - For port number to use for TCP multi-listen mode.
  152.     multimax - The max number of connections to accept for TCP multi-listen.
  153. Flag configuration variables:
  154.     options - General program options.
  155.     packets - Which types of IPX packets to forward.
  156.     protos - Which types of IPv4 protocols to forward.
  157. String configuration variables:
  158.     natinternal - The internal hostname/IP if using Alter Source IP
  159.     natexternal - The external hostname/IP if using Alter Source IP
  160. Multiline configuration variables:
  161.     hosts - The list of hosts to connect/listen to, one per line.
  162.     sockets - The list of IPX socket ranges to forward.
  163.     ports - The list of TCP/UDP port ranges to forward.
  164.  
  165. Flag bit variables are used for the flag configuration variables as shortcuts
  166. to the various bits' meanings.
  167. Flags for options:
  168.     OPT_FRAME_8022 - Look into IEEE 802.2 frames
  169.     OPT_FRAME_8023 - Look into IEEE 802.3 (Novall "raw") frames
  170.     OPT_FRAME_ETH2 - Look into Ethernet II frames
  171.     OPT_FRAME_SNAP - Look into Ethernet SNAP frames
  172.     OPT_IPV4_NOUC - Don't Send Unicast IPv4 Option
  173.     OPT_IPV4_NAT - Alter Source IP (for NAT) IPv4 Option
  174.     OPT_IPV4_NOBC - Don't Send Broadcast IPv4 Option
  175.     OPT_IPV4_SRCP - Also Match Source Port IPv4 Option
  176.     OPT_IPV4_NORT - Don't Send Routable IPv4 Option
  177.     OPT_TCP_MULTI - Be TCP multi-listen server instead
  178.     OPT_OTHER_ARP - Forward ARP Other Option
  179.     OPT_OTHER_ORFP - Use Old Reforward Prevention Method for IPX/IPv4 Frames
  180.     OPT_COMP_ZLIB - Use ZLib Compression
  181. Flags for packets:
  182.     PACKET_OLD - Forward NLSP / Old IPX packets
  183.     PACKET_RIP - Forward RIP IPX packets
  184.     PACKET_ECO - Forward Echo IPX packets
  185.     PACKET_ERR - Forward Error IPX packets
  186.     PACKET_IPX - Forward IPX normal packets
  187.     PACKET_SPX - Forward SPX / SPX II packets
  188.     PACKET_NCP - Forward NCP IPX packets
  189.     PACKET_NTB - Forward NetBIOS IPX packets
  190. Flags for protos:
  191.     PROTO_ICMP - Forward IPv4 ICMP protocol
  192.     PROTO_TCP - Forward IPv4 TCP protocol
  193.     PROTO_UDP - Forward IPv4 UDP protocol
  194.  
  195. String helper variables contain shortcut strings to ensure script writers
  196. do not have to use strings that the configuration variables expect to be spelled
  197. perfectly.
  198. String helpers for hosts, contain a space followed by a word in ()
  199.     METH_UDP - Host method UDP
  200.     METH_TCP_LISTEN - Host method TCP listen
  201.     METH_TCP_CONNECT - Host method TCP connect
  202.     METH_TCP_CONNECT_SOCKS4 - Host method TCP connect using socks4
  203.     METH_TCP_CONNECT_SOCKS5 - Host method TCP connect using socks5
  204.  
  205. Pre-set variables are not really special, but are set by the first wizard page
  206. and can be used if the script writer wants to use them.
  207.     scripts - Contains a list of all script choices, one per line.
  208.     scriptcontrol - The text used to display the script dropdown control
  209.         (or label, if a .git file was loaded externally).
  210.     script - The integer index of the script from the list that was
  211.         selected from the dropdown.
  212.     scriptname - The name of the script that was selected.  This should be
  213.         the name of the program that the script is trying to configure
  214.         GIT for.
  215.     devices - Contains a list of all the available network packet devices.
  216.     devicecontrol - The text used to display the device dropdown control.
  217.     device - The integer index of the device that was selected. This
  218.         variable is also a special configuration variable.
  219.  
  220.  
  221. ---------------
  222. Dialog Controls
  223. ---------------
  224. The contents of the special variables called 'heading' and 'subheading' are
  225. placed in the white area at the top of the wizard page.  The special variable
  226. called 'control' is used to add controls to the wizard page.
  227. Each line of the string in 'control' represents one control.
  228. Each line has several parameters, delimited by a '|' character.
  229. Parameter 1: Control type
  230. Parameter 2: Variable name to bind control data to
  231. Parameter 3: Text label for the control
  232. Parameter 4: Control size
  233. Parameter 5+: Item choices
  234. Parameters can be omitted and a sane default will be used. Parameters may also
  235. contain whitespace on the left or right sides of the text which will be trimmed
  236. off when parsing the control variable.
  237. The control variable as well as the heading and subheading are cleared after a
  238. call to showpage.
  239.  
  240. Blank Space
  241. -----------
  242. Control: space 
  243. Variable: Unused
  244. Text: Unused
  245. Size: Amount of vertical space to skip, in 1/2 line units.  There are 18 usable
  246.     lines (36 1/2 lines) of space on the wizard page.
  247. Choices: Unused
  248.  
  249. Text Label
  250. ----------
  251. Control: label
  252. Variable: The text of the label will be overwritten with the contents of this
  253.     variable, if a variable is specified.
  254. Text: Text to display.
  255. Size: Number of lines of text to reserve.
  256. Choices: Unused
  257.  
  258. Checkbox
  259. --------
  260. Control: check
  261. Variable: Integer (0 or 1)
  262. Text: Displayed to the right of the checkbox on the same line.
  263. Size: Unused
  264. Choices: Unused
  265.  
  266. Radio Buttons
  267. -------------
  268. Control: radio
  269. Variable: Integer (0 to the number of choices-1)
  270. Text: Displayed to the left of the radio buttons
  271. Size: Number of columns to divide up the space into.  Radio buttons will wrap
  272.     around to the next line as needed, if there are more choices then
  273.     columns.  The text label will take up the same amount of space as a
  274.     single radio choice, unless it is omitted or blank.
  275. Choices: One per radio button
  276.  
  277. Dropdown Box
  278. ------------
  279. Control: dropd
  280. Variable: Integer (0 to the number of choices-1)
  281. Text: Displayed to the left of the dropdown using all but the last column
  282. Size: Number of columns to divide up the space into.  The dropdown will take up
  283.     only the first column if the text is omitted or blank, otherwise the
  284.     dropdown will take up only the last column.
  285. Choices: Displayed in a list of the dropdown, one per line.
  286.  
  287. Combo Box
  288. ---------
  289. Control: combo
  290. Variable: String
  291. Text: Displayed to the left of the combo box using all but the last column
  292. Size: Number of columns to divide up the space into.  The combo box will take up
  293.     only the first column if the text is omitted or blank, otherwise the
  294.     combo box will take up only the last column.
  295. Choices: Displayed in a list of the combo box, one per line.
  296.  
  297. Text Box
  298. --------
  299. Control: text1
  300. Variable: String
  301. Text: Displayed to the left of the text box using all but the last column
  302. Size: Number of columns to divide up the space into.  The text box will take up
  303.     only the first column if the text is omitted or blank, otherwise the
  304.     text box will take up only the last column.
  305. Choices: Unused
  306.  
  307. Read-only Text
  308. --------------
  309. Control: textr
  310. Variable: String (Read into textbox, not stored back into variable though)
  311. Text: Displayed to the left of the text box using all but the last column
  312. Size: Number of columns to divide up the space into.  The text box will take up
  313.     only the first column if the text is omitted or blank, otherwise the
  314.     text box will take up only the last column.
  315. Choices: Unused
  316.  
  317. Multiline Text
  318. --------------
  319. Control: textm
  320. Variable: String
  321. Text: Displayed on a line above the multiline text box, unless omitted or blank.
  322. Size: Maximum number of lines of text the user will be able to type.
  323. Choices: Unused
  324.  
  325. Horizonal Line
  326. --------------
  327. Control: hline
  328. Variable: Unused
  329. Text: Unused
  330. Size: Unused
  331. Choices: Unused
  332.  
  333. Special Controls
  334. ----------------
  335. Control: specl
  336. Variable: Unused
  337. Text: Determines what type of special control to add. Currently the choices
  338.     are autoconf, saveprof, and ipfwnat.
  339.     'autoconf' will display a button used to skip all calls to showpage,
  340.     unless a call to loadvar fails.  This button is placed on the first
  341.     wizard page automatically.  Using this allows scripts use saveval to
  342.     save important settings to the registry and later use loadval to load
  343.     these settings.  As long as all loadval's succeed, the script can be
  344.     ran without any more user intervention, to prevent asking the user
  345.     questions they answered the first time they ran the script.
  346.     'saveprof' will display a button used to automatically write a short
  347.     .git wizard script that just resets the current settings. This allows
  348.     users to customize profiles that can quickly restore with the wizard.
  349.     'ipfwnat' will display a button used to guess the user's IP address
  350.     information.  This button will alter the objects on the wizard page
  351.     numbered 1, 3, 4, 6, and 7. Each control other then specl generates one
  352.     or more objects numbered incrementally starting at 0.
  353. Size: Unused
  354. Choices: Unused
  355.  
  356.  
  357. -------
  358. Example
  359. -------
  360. # This script will display the Network Configuration wizard page
  361. loadvar hostname
  362. loadvar firewall
  363. loadvar nat
  364. loadvar externalhostname
  365. setvar heading "Network Configuration"
  366. setvar subheading "Please enter your IP address information below."
  367. addline control "label||What is your hostname or IP address?"
  368. addline control "text1|hostname||4"
  369. addline control "label||Are you open to receive incoming connections or are you firewalled?"
  370. addline control "radio|firewall||4|Open|Firewalled"
  371. addline control "label||Do you have a direct connection to the Internet or are you using NAT?"
  372. addline control "radio|nat||4|Direct Connection|NAT"
  373. addline control "label||If you are using NAT, what is your external hostname or IP address?"
  374. addline control "text1|externalhostname||4"
  375. addline control "space|||3"
  376. addline control "specl||ipfwnat";
  377. showpage
  378. savevar hostname
  379. savevar firewall
  380. savevar nat
  381. savevar externalhostname
  382.